<template>
    <div></div>
</template>
<script lang="ts" setup>
import { useResourceStore } from '@/store/resource';
    import { useRouter } from 'vue-router';
    let resourceStore = useResourceStore()
    let router = useRouter()

    let defaultPath = ''

    function getDefaultPath(menus:any[]) {
        for(let i = 0; i < menus.length; i ++) {
            const menu = menus[i]
            if(menu.children && menu.children.length > 0) {
                getDefaultPath(menu.children)
            }else {
                defaultPath = menu.routeName
                return 
            }
        }
    }

    getDefaultPath(resourceStore.menus)
    router.push({
        name : defaultPath
    })

</script>